home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / libs / newlooklib.lha / newlook / togglebutton.c < prev   
C/C++ Source or Header  |  1993-10-03  |  553b  |  19 lines

  1. /*
  2.  *  TOGGLEBUTTON.C
  3.  */
  4.  
  5. #include "newlook.h"
  6.  
  7. extern UWORD RemoveGadget( struct Window *, struct Gadget * );
  8. extern VOID RefreshGList( struct Gadget *, struct Window *, struct Requester *, UWORD );
  9. extern UWORD AddGadget( struct Window *, struct Gadget *, UWORD );
  10.  
  11. void ToggleButton(struct Window *w, struct Gadget *g)
  12. { UWORD pos= RemoveGadget(w,g);
  13.   RefreshGList(g,w,0L,1L);
  14.   g->Flags ^= SELECTED;
  15.   if(pos!=0xFFFF) /* 0xFFFF == (-1)  did we really remove the gadget? */
  16.     AddGadget(w,g,pos); /* 0xFFFF == (-1) */
  17.   RefreshGList(g,w,0L,1L);
  18. }
  19.